<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>信息</title>
	<!--<script src="http://code.jquery.com/jquery-latest.js"></script>-->
</head>
<body>
<form id="from" method="post" th:action="upload" enctype="multipart/form-data">


		 名称：<input type="text" name="name"><br />
		 介绍：<input type="text" name="introduction"><br />
		 价格：<input type="text" name="price"><br />
		 图片：<input type="file" name="imgFile"><br />
		 <input id="upload" type="submit" value="提交">
	</form>
<!--<script>
/*	$(window).ready(function () {*/
		$("#upload").click(function() {
			var formData = new FormData($("#from")[0]);
			$.ajax({
				// ${pageContext.request.contextPath}
				type: "POST",
				dataType:"json",
				url: "upload",
				data: formData,
				cache: false,
				processData: false,
				contentType: false,
				success :function (data) {
					if (data.code==300){
						console.log("成功");
					}

				},
				error: function (e) {
					alert("错误！！");
				}
			})
		})
/*	})*/
</script>-->
</body>
</html>